package kz.pompei.var.atom.concretes;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import kz.pompei.var.atom.Atom;
import kz.pompei.var.atom.Atomizer;

import org.junit.Test;

public class SecondAtomizerTest {
  @Test
  public void asd() throws Exception {
    InputStream in = getClass()
        .getResourceAsStream( "/test/analizer/Test2.txt" );
    
    Atomizer a = new SecondAtomizer();
    a.setErrorReciever( new TestErrorReciever() );
    TestAtomCollector atoms = new TestAtomCollector();
    a.setReciever( atoms );
    
    a.start();
    
    BufferedReader br = new BufferedReader( new InputStreamReader( in, "UTF-8" ) );
    String line = null;
    while ((line = br.readLine()) != null) {
      a.appendLine( line );
    }
    br.close();
    
    a.finish();
    
    for (Atom atom : atoms.getList()) {
      atom.print( System.out );
    }
    
  }
}
